<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LINE 1 &quot;libraries\\ghci\\GHCi\\FFI.hsc&quot; #-}</span><span>
</span><span id="line-1"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-2"></span><span class="hs-comment">--</span><span>
</span><span id="line-3"></span><span class="hs-comment">-- libffi bindings</span><span>
</span><span id="line-4"></span><span class="hs-comment">--</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- (c) The University of Glasgow 2008</span><span>
</span><span id="line-6"></span><span class="hs-comment">--</span><span>
</span><span id="line-7"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-8"></span><span>
</span><span id="line-9"></span><span>
</span><span id="line-10"></span><span>
</span><span id="line-11"></span><span class="hs-pragma">{-# LANGUAGE CPP, DeriveGeneric, DeriveAnyClass #-}</span><span>
</span><span id="line-12"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHCi.FFI</span><span>
</span><span id="line-13"></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHCi.FFI.html#FFIType"><span class="hs-identifier">FFIType</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-14"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.FFI.html#FFIConv"><span class="hs-identifier">FFIConv</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-15"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_cif"><span class="hs-identifier">C_ffi_cif</span></a></span><span>
</span><span id="line-16"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.FFI.html#prepForeignCall"><span class="hs-identifier">prepForeignCall</span></a></span><span>
</span><span id="line-17"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.FFI.html#freeForeignCallInfo"><span class="hs-identifier">freeForeignCallInfo</span></a></span><span>
</span><span id="line-18"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-19"></span><span>
</span><span id="line-20"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Prelude.html#"><span class="hs-identifier">Prelude</span></a></span><span> </span><span class="hs-comment">-- See note [Why do we import Prelude here?]</span><span>
</span><span id="line-21"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Exception.html#"><span class="hs-identifier">Control.Exception</span></a></span><span>
</span><span id="line-22"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../binary/src/Data.Binary.html#"><span class="hs-identifier">Data.Binary</span></a></span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/GHC.Generics.html#"><span class="hs-identifier">GHC.Generics</span></a></span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.html#"><span class="hs-identifier">Foreign</span></a></span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Foreign.C.html#"><span class="hs-identifier">Foreign.C</span></a></span><span>
</span><span id="line-26"></span><span>
</span><span id="line-27"></span><span id="local-6989586621679086716"><span id="local-6989586621679086717"></span></span><span class="hs-keyword">data</span><span> </span><span id="FFIType"><span class="annot"><a href="GHCi.FFI.html#FFIType"><span class="hs-identifier hs-var">FFIType</span></a></span></span><span>
</span><span id="line-28"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="FFIVoid"><span class="annot"><a href="GHCi.FFI.html#FFIVoid"><span class="hs-identifier hs-var">FFIVoid</span></a></span></span><span>
</span><span id="line-29"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="FFIPointer"><span class="annot"><a href="GHCi.FFI.html#FFIPointer"><span class="hs-identifier hs-var">FFIPointer</span></a></span></span><span>
</span><span id="line-30"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="FFIFloat"><span class="annot"><a href="GHCi.FFI.html#FFIFloat"><span class="hs-identifier hs-var">FFIFloat</span></a></span></span><span>
</span><span id="line-31"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="FFIDouble"><span class="annot"><a href="GHCi.FFI.html#FFIDouble"><span class="hs-identifier hs-var">FFIDouble</span></a></span></span><span>
</span><span id="line-32"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="FFISInt8"><span class="annot"><a href="GHCi.FFI.html#FFISInt8"><span class="hs-identifier hs-var">FFISInt8</span></a></span></span><span>
</span><span id="line-33"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="FFISInt16"><span class="annot"><a href="GHCi.FFI.html#FFISInt16"><span class="hs-identifier hs-var">FFISInt16</span></a></span></span><span>
</span><span id="line-34"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="FFISInt32"><span class="annot"><a href="GHCi.FFI.html#FFISInt32"><span class="hs-identifier hs-var">FFISInt32</span></a></span></span><span>
</span><span id="line-35"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="FFISInt64"><span class="annot"><a href="GHCi.FFI.html#FFISInt64"><span class="hs-identifier hs-var">FFISInt64</span></a></span></span><span>
</span><span id="line-36"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="FFIUInt8"><span class="annot"><a href="GHCi.FFI.html#FFIUInt8"><span class="hs-identifier hs-var">FFIUInt8</span></a></span></span><span>
</span><span id="line-37"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="FFIUInt16"><span class="annot"><a href="GHCi.FFI.html#FFIUInt16"><span class="hs-identifier hs-var">FFIUInt16</span></a></span></span><span>
</span><span id="line-38"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="FFIUInt32"><span class="annot"><a href="GHCi.FFI.html#FFIUInt32"><span class="hs-identifier hs-var">FFIUInt32</span></a></span></span><span>
</span><span id="line-39"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="FFIUInt64"><span class="annot"><a href="GHCi.FFI.html#FFIUInt64"><span class="hs-identifier hs-var">FFIUInt64</span></a></span></span><span>
</span><span id="line-40"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679086698"><span id="local-6989586621679086700"><span id="local-6989586621679086702"><span class="annot"><span class="annottext">Int -&gt; FFIType -&gt; ShowS
[FFIType] -&gt; ShowS
FFIType -&gt; String
(Int -&gt; FFIType -&gt; ShowS)
-&gt; (FFIType -&gt; String) -&gt; ([FFIType] -&gt; ShowS) -&gt; Show FFIType
forall a.
(Int -&gt; a -&gt; ShowS) -&gt; (a -&gt; String) -&gt; ([a] -&gt; ShowS) -&gt; Show a
showList :: [FFIType] -&gt; ShowS
$cshowList :: [FFIType] -&gt; ShowS
show :: FFIType -&gt; String
$cshow :: FFIType -&gt; String
showsPrec :: Int -&gt; FFIType -&gt; ShowS
$cshowsPrec :: Int -&gt; FFIType -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Show</span></a></span></span></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(forall x. FFIType -&gt; Rep FFIType x)
-&gt; (forall x. Rep FFIType x -&gt; FFIType) -&gt; Generic FFIType
forall x. Rep FFIType x -&gt; FFIType
forall x. FFIType -&gt; Rep FFIType x
forall a.
(forall x. a -&gt; Rep a x) -&gt; (forall x. Rep a x -&gt; a) -&gt; Generic a
$cto :: forall x. Rep FFIType x -&gt; FFIType
$cfrom :: forall x. FFIType -&gt; Rep FFIType x
</span><a href="../../base/src/GHC.Generics.html#Generic"><span class="hs-identifier hs-var hs-var hs-var hs-var">Generic</span></a></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679086688"><span id="local-6989586621679086690"><span id="local-6989586621679086692"><span class="annot"><span class="annottext">Get FFIType
[FFIType] -&gt; Put
FFIType -&gt; Put
(FFIType -&gt; Put)
-&gt; Get FFIType -&gt; ([FFIType] -&gt; Put) -&gt; Binary FFIType
forall t. (t -&gt; Put) -&gt; Get t -&gt; ([t] -&gt; Put) -&gt; Binary t
putList :: [FFIType] -&gt; Put
$cputList :: [FFIType] -&gt; Put
get :: Get FFIType
$cget :: Get FFIType
put :: FFIType -&gt; Put
$cput :: FFIType -&gt; Put
</span><a href="../../binary/src/Data.Binary.Class.html#C%3ABinary"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Binary</span></a></span></span></span></span><span class="hs-special">)</span><span>
</span><span id="line-41"></span><span>
</span><span id="line-42"></span><span id="local-6989586621679086685"><span id="local-6989586621679086686"></span></span><span class="hs-keyword">data</span><span> </span><span id="FFIConv"><span class="annot"><a href="GHCi.FFI.html#FFIConv"><span class="hs-identifier hs-var">FFIConv</span></a></span></span><span>
</span><span id="line-43"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="FFICCall"><span class="annot"><a href="GHCi.FFI.html#FFICCall"><span class="hs-identifier hs-var">FFICCall</span></a></span></span><span>
</span><span id="line-44"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="FFIStdCall"><span class="annot"><a href="GHCi.FFI.html#FFIStdCall"><span class="hs-identifier hs-var">FFIStdCall</span></a></span></span><span>
</span><span id="line-45"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679086677"><span id="local-6989586621679086679"><span id="local-6989586621679086681"><span class="annot"><span class="annottext">Int -&gt; FFIConv -&gt; ShowS
[FFIConv] -&gt; ShowS
FFIConv -&gt; String
(Int -&gt; FFIConv -&gt; ShowS)
-&gt; (FFIConv -&gt; String) -&gt; ([FFIConv] -&gt; ShowS) -&gt; Show FFIConv
forall a.
(Int -&gt; a -&gt; ShowS) -&gt; (a -&gt; String) -&gt; ([a] -&gt; ShowS) -&gt; Show a
showList :: [FFIConv] -&gt; ShowS
$cshowList :: [FFIConv] -&gt; ShowS
show :: FFIConv -&gt; String
$cshow :: FFIConv -&gt; String
showsPrec :: Int -&gt; FFIConv -&gt; ShowS
$cshowsPrec :: Int -&gt; FFIConv -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Show</span></a></span></span></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(forall x. FFIConv -&gt; Rep FFIConv x)
-&gt; (forall x. Rep FFIConv x -&gt; FFIConv) -&gt; Generic FFIConv
forall x. Rep FFIConv x -&gt; FFIConv
forall x. FFIConv -&gt; Rep FFIConv x
forall a.
(forall x. a -&gt; Rep a x) -&gt; (forall x. Rep a x -&gt; a) -&gt; Generic a
$cto :: forall x. Rep FFIConv x -&gt; FFIConv
$cfrom :: forall x. FFIConv -&gt; Rep FFIConv x
</span><a href="../../base/src/GHC.Generics.html#Generic"><span class="hs-identifier hs-var hs-var hs-var hs-var">Generic</span></a></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679086669"><span id="local-6989586621679086671"><span id="local-6989586621679086673"><span class="annot"><span class="annottext">Get FFIConv
[FFIConv] -&gt; Put
FFIConv -&gt; Put
(FFIConv -&gt; Put)
-&gt; Get FFIConv -&gt; ([FFIConv] -&gt; Put) -&gt; Binary FFIConv
forall t. (t -&gt; Put) -&gt; Get t -&gt; ([t] -&gt; Put) -&gt; Binary t
putList :: [FFIConv] -&gt; Put
$cputList :: [FFIConv] -&gt; Put
get :: Get FFIConv
$cget :: Get FFIConv
put :: FFIConv -&gt; Put
$cput :: FFIConv -&gt; Put
</span><a href="#local-6989586621679086669"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Binary</span></a></span></span></span></span><span class="hs-special">)</span><span>
</span><span id="line-46"></span><span>
</span><span id="line-47"></span><span>
</span><span id="line-48"></span><span class="annot"><a href="GHCi.FFI.html#prepForeignCall"><span class="hs-identifier hs-type">prepForeignCall</span></a></span><span>
</span><span id="line-49"></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHCi.FFI.html#FFIConv"><span class="hs-identifier hs-type">FFIConv</span></a></span><span>
</span><span id="line-50"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHCi.FFI.html#FFIType"><span class="hs-identifier hs-type">FFIType</span></a></span><span class="hs-special">]</span><span>          </span><span class="hs-comment">-- arg types</span><span>
</span><span id="line-51"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHCi.FFI.html#FFIType"><span class="hs-identifier hs-type">FFIType</span></a></span><span>            </span><span class="hs-comment">-- result type</span><span>
</span><span id="line-52"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_cif"><span class="hs-identifier hs-type">C_ffi_cif</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- token for making calls (must be freed by caller)</span><span>
</span><span id="line-53"></span><span>
</span><span id="line-54"></span><span id="prepForeignCall"><span class="annot"><span class="annottext">prepForeignCall :: FFIConv -&gt; [FFIType] -&gt; FFIType -&gt; IO (Ptr C_ffi_cif)
</span><a href="GHCi.FFI.html#prepForeignCall"><span class="hs-identifier hs-var hs-var">prepForeignCall</span></a></span></span><span> </span><span id="local-6989586621679086668"><span class="annot"><span class="annottext">FFIConv
</span><a href="#local-6989586621679086668"><span class="hs-identifier hs-var">cconv</span></a></span></span><span> </span><span id="local-6989586621679086667"><span class="annot"><span class="annottext">[FFIType]
</span><a href="#local-6989586621679086667"><span class="hs-identifier hs-var">arg_types</span></a></span></span><span> </span><span id="local-6989586621679086666"><span class="annot"><span class="annottext">FFIType
</span><a href="#local-6989586621679086666"><span class="hs-identifier hs-var">result_type</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-55"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679086664"><span class="annot"><span class="annottext">n_args :: Int
</span><a href="#local-6989586621679086664"><span class="hs-identifier hs-var hs-var">n_args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[FFIType] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[FFIType]
</span><a href="#local-6989586621679086667"><span class="hs-identifier hs-var">arg_types</span></a></span><span>
</span><span id="line-56"></span><span>  </span><span id="local-6989586621679086662"><span class="annot"><span class="annottext">Ptr (Ptr C_ffi_type)
</span><a href="#local-6989586621679086662"><span class="hs-identifier hs-var">arg_arr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; IO (Ptr (Ptr C_ffi_type))
forall a. Storable a =&gt; Int -&gt; IO (Ptr a)
</span><a href="../../base/src/Foreign.Marshal.Array.html#mallocArray"><span class="hs-identifier hs-var">mallocArray</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086664"><span class="hs-identifier hs-var">n_args</span></a></span><span>
</span><span id="line-57"></span><span>  </span><span class="annot"><span class="annottext">Ptr (Ptr C_ffi_type) -&gt; [Ptr C_ffi_type] -&gt; IO ()
forall a. Storable a =&gt; Ptr a -&gt; [a] -&gt; IO ()
</span><a href="../../base/src/Foreign.Marshal.Array.html#pokeArray"><span class="hs-identifier hs-var">pokeArray</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr (Ptr C_ffi_type)
</span><a href="#local-6989586621679086662"><span class="hs-identifier hs-var">arg_arr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(FFIType -&gt; Ptr C_ffi_type) -&gt; [FFIType] -&gt; [Ptr C_ffi_type]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">FFIType -&gt; Ptr C_ffi_type
</span><a href="GHCi.FFI.html#ffiType"><span class="hs-identifier hs-var">ffiType</span></a></span><span> </span><span class="annot"><span class="annottext">[FFIType]
</span><a href="#local-6989586621679086667"><span class="hs-identifier hs-var">arg_types</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-58"></span><span>  </span><span id="local-6989586621679086658"><span class="annot"><span class="annottext">Ptr C_ffi_cif
</span><a href="#local-6989586621679086658"><span class="hs-identifier hs-var">cif</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; IO (Ptr C_ffi_cif)
forall a. Int -&gt; IO (Ptr a)
</span><a href="../../base/src/Foreign.Marshal.Alloc.html#mallocBytes"><span class="hs-identifier hs-var">mallocBytes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">32</span></span><span class="hs-special">)</span><span>
</span><span id="line-59"></span><span class="hs-pragma">{-# LINE 59 &quot;libraries\\ghci\\GHCi\\FFI.hsc&quot; #-}</span><span>
</span><span id="line-59"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">abi</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">convToABI</span><span> </span><span class="hs-identifier">cconv</span><span>
</span><span id="line-60"></span><span>  </span><span id="local-6989586621679086654"><span class="annot"><span class="annottext">C_ffi_abi
</span><a href="#local-6989586621679086654"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Ptr C_ffi_cif
-&gt; C_ffi_abi
-&gt; CUInt
-&gt; Ptr C_ffi_type
-&gt; Ptr (Ptr C_ffi_type)
-&gt; IO C_ffi_abi
</span><a href="GHCi.FFI.html#ffi_prep_cif"><span class="hs-identifier hs-var">ffi_prep_cif</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr C_ffi_cif
</span><a href="#local-6989586621679086658"><span class="hs-identifier hs-var">cif</span></a></span><span> </span><span class="annot"><span class="annottext">C_ffi_abi
</span><a href="#local-6989586621679086656"><span class="hs-identifier hs-var">abi</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; CUInt
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679086664"><span class="hs-identifier hs-var">n_args</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FFIType -&gt; Ptr C_ffi_type
</span><a href="GHCi.FFI.html#ffiType"><span class="hs-identifier hs-var">ffiType</span></a></span><span> </span><span class="annot"><span class="annottext">FFIType
</span><a href="#local-6989586621679086666"><span class="hs-identifier hs-var">result_type</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Ptr (Ptr C_ffi_type)
</span><a href="#local-6989586621679086662"><span class="hs-identifier hs-var">arg_arr</span></a></span><span>
</span><span id="line-61"></span><span>  </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">C_ffi_abi
</span><a href="#local-6989586621679086654"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">C_ffi_abi -&gt; C_ffi_abi -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">C_ffi_abi
</span><a href="GHCi.FFI.html#fFI_OK"><span class="hs-identifier hs-var">fFI_OK</span></a></span><span> </span><span class="hs-keyword">then</span><span>
</span><span id="line-62"></span><span>    </span><span class="annot"><span class="annottext">ErrorCall -&gt; IO (Ptr C_ffi_cif)
forall e a. Exception e =&gt; e -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#throwIO"><span class="hs-identifier hs-var">throwIO</span></a></span><span> </span><span class="annot"><span class="annottext">(ErrorCall -&gt; IO (Ptr C_ffi_cif))
-&gt; ErrorCall -&gt; IO (Ptr C_ffi_cif)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; ErrorCall
</span><a href="../../base/src/GHC.Exception.html#ErrorCall"><span class="hs-identifier hs-var">ErrorCall</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; ErrorCall) -&gt; String -&gt; ErrorCall
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; String
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span>
</span><span id="line-63"></span><span>      </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;prepForeignCallFailed: &quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">C_ffi_abi -&gt; String
</span><a href="GHCi.FFI.html#strError"><span class="hs-identifier hs-var">strError</span></a></span><span> </span><span class="annot"><span class="annottext">C_ffi_abi
</span><a href="#local-6989586621679086654"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-64"></span><span>        </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;(cconv: &quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">FFIConv -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">FFIConv
</span><a href="#local-6989586621679086668"><span class="hs-identifier hs-var">cconv</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-65"></span><span>        </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; arg tys: &quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[FFIType] -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">[FFIType]
</span><a href="#local-6989586621679086667"><span class="hs-identifier hs-var">arg_types</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-66"></span><span>        </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; res ty: &quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">FFIType -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">FFIType
</span><a href="#local-6989586621679086666"><span class="hs-identifier hs-var">result_type</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;)&quot;</span></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-67"></span><span>  </span><span class="hs-keyword">else</span><span>
</span><span id="line-68"></span><span>    </span><span class="annot"><span class="annottext">Ptr C_ffi_cif -&gt; IO (Ptr C_ffi_cif)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Ptr C_ffi_cif -&gt; Ptr C_ffi_cif
forall a b. Ptr a -&gt; Ptr b
</span><a href="../../base/src/GHC.Ptr.html#castPtr"><span class="hs-identifier hs-var">castPtr</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr C_ffi_cif
</span><a href="#local-6989586621679086658"><span class="hs-identifier hs-var">cif</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-69"></span><span>
</span><span id="line-70"></span><span class="annot"><a href="GHCi.FFI.html#freeForeignCallInfo"><span class="hs-identifier hs-type">freeForeignCallInfo</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_cif"><span class="hs-identifier hs-type">C_ffi_cif</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-71"></span><span id="freeForeignCallInfo"><span class="annot"><span class="annottext">freeForeignCallInfo :: Ptr C_ffi_cif -&gt; IO ()
</span><a href="GHCi.FFI.html#freeForeignCallInfo"><span class="hs-identifier hs-var hs-var">freeForeignCallInfo</span></a></span></span><span> </span><span id="local-6989586621679086644"><span class="annot"><span class="annottext">Ptr C_ffi_cif
</span><a href="#local-6989586621679086644"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-72"></span><span>  </span><span class="annot"><span class="annottext">Ptr Any -&gt; IO ()
forall a. Ptr a -&gt; IO ()
</span><a href="../../base/src/Foreign.Marshal.Alloc.html#free"><span class="hs-identifier hs-var">free</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679086642"><span class="annot"><span class="annottext">Ptr C_ffi_cif
</span><a href="#local-6989586621679086642"><span class="hs-identifier hs-var">hsc_ptr</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Ptr C_ffi_cif
</span><a href="#local-6989586621679086642"><span class="hs-identifier hs-var">hsc_ptr</span></a></span><span> </span><span class="annot"><span class="annottext">Ptr C_ffi_cif -&gt; Int -&gt; Ptr Any
forall a b. Ptr a -&gt; Int -&gt; Ptr b
</span><a href="../../base/src/GHC.Ptr.html#plusPtr"><span class="hs-operator hs-var">`plusPtr`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">8</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Ptr C_ffi_cif
</span><a href="#local-6989586621679086644"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-73"></span><span class="hs-pragma">{-# LINE 73 &quot;libraries\\ghci\\GHCi\\FFI.hsc&quot; #-}</span><span>
</span><span id="line-73"></span><span>  </span><span class="hs-identifier">free</span><span> </span><span class="hs-identifier">p</span><span>
</span><span id="line-74"></span><span>
</span><span id="line-75"></span><span class="annot"><a href="GHCi.FFI.html#strError"><span class="hs-identifier hs-type">strError</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_status"><span class="hs-identifier hs-type">C_ffi_status</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-76"></span><span id="strError"><span class="annot"><span class="annottext">strError :: C_ffi_abi -&gt; String
</span><a href="GHCi.FFI.html#strError"><span class="hs-identifier hs-var hs-var">strError</span></a></span></span><span> </span><span id="local-6989586621679086639"><span class="annot"><span class="annottext">C_ffi_abi
</span><a href="#local-6989586621679086639"><span class="hs-identifier hs-var">r</span></a></span></span><span>
</span><span id="line-77"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">C_ffi_abi
</span><a href="#local-6989586621679086639"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">C_ffi_abi -&gt; C_ffi_abi -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">C_ffi_abi
</span><a href="GHCi.FFI.html#fFI_BAD_ABI"><span class="hs-identifier hs-var">fFI_BAD_ABI</span></a></span><span>
</span><span id="line-78"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;invalid ABI (FFI_BAD_ABI)&quot;</span></span><span>
</span><span id="line-79"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">C_ffi_abi
</span><a href="#local-6989586621679086639"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">C_ffi_abi -&gt; C_ffi_abi -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">C_ffi_abi
</span><a href="GHCi.FFI.html#fFI_BAD_TYPEDEF"><span class="hs-identifier hs-var">fFI_BAD_TYPEDEF</span></a></span><span>
</span><span id="line-80"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;invalid type description (FFI_BAD_TYPEDEF)&quot;</span></span><span>
</span><span id="line-81"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-82"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;unknown error: &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">C_ffi_abi -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">C_ffi_abi
</span><a href="#local-6989586621679086639"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-83"></span><span>
</span><span id="line-84"></span><span class="annot"><a href="GHCi.FFI.html#convToABI"><span class="hs-identifier hs-type">convToABI</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHCi.FFI.html#FFIConv"><span class="hs-identifier hs-type">FFIConv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_abi"><span class="hs-identifier hs-type">C_ffi_abi</span></a></span><span>
</span><span id="line-85"></span><span id="convToABI"><span class="annot"><span class="annottext">convToABI :: FFIConv -&gt; C_ffi_abi
</span><a href="GHCi.FFI.html#convToABI"><span class="hs-identifier hs-var hs-var">convToABI</span></a></span></span><span> </span><span class="annot"><span class="annottext">FFIConv
</span><a href="GHCi.FFI.html#FFICCall"><span class="hs-identifier hs-var">FFICCall</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">C_ffi_abi
</span><a href="GHCi.FFI.html#fFI_DEFAULT_ABI"><span class="hs-identifier hs-var">fFI_DEFAULT_ABI</span></a></span><span>
</span><span id="line-86"></span><span>
</span><span id="line-87"></span><span class="hs-pragma">{-# LINE 89 &quot;libraries\\ghci\\GHCi\\FFI.hsc&quot; #-}</span><span>
</span><span id="line-89"></span><span class="hs-comment">-- unknown conventions are mapped to the default, (#3336)</span><span>
</span><span id="line-90"></span><span class="annot"><a href="GHCi.FFI.html#convToABI"><span class="hs-identifier hs-var">convToABI</span></a></span><span> </span><span class="annot"><span class="annottext">FFIConv
</span><span class="hs-identifier">_</span></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">C_ffi_abi
</span><a href="GHCi.FFI.html#fFI_DEFAULT_ABI"><span class="hs-identifier hs-var">fFI_DEFAULT_ABI</span></a></span><span>
</span><span id="line-91"></span><span>
</span><span id="line-92"></span><span class="annot"><a href="GHCi.FFI.html#ffiType"><span class="hs-identifier hs-type">ffiType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHCi.FFI.html#FFIType"><span class="hs-identifier hs-type">FFIType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_type"><span class="hs-identifier hs-type">C_ffi_type</span></a></span><span>
</span><span id="line-93"></span><span id="ffiType"><span class="annot"><span class="annottext">ffiType :: FFIType -&gt; Ptr C_ffi_type
</span><a href="GHCi.FFI.html#ffiType"><span class="hs-identifier hs-var hs-var">ffiType</span></a></span></span><span> </span><span class="annot"><span class="annottext">FFIType
</span><a href="GHCi.FFI.html#FFIVoid"><span class="hs-identifier hs-var">FFIVoid</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ptr C_ffi_type
</span><a href="GHCi.FFI.html#ffi_type_void"><span class="hs-identifier hs-var">ffi_type_void</span></a></span><span>
</span><span id="line-94"></span><span class="annot"><a href="GHCi.FFI.html#ffiType"><span class="hs-identifier hs-var">ffiType</span></a></span><span> </span><span class="annot"><span class="annottext">FFIType
</span><a href="GHCi.FFI.html#FFIPointer"><span class="hs-identifier hs-var">FFIPointer</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ptr C_ffi_type
</span><a href="GHCi.FFI.html#ffi_type_pointer"><span class="hs-identifier hs-var">ffi_type_pointer</span></a></span><span>
</span><span id="line-95"></span><span class="annot"><a href="GHCi.FFI.html#ffiType"><span class="hs-identifier hs-var">ffiType</span></a></span><span> </span><span class="annot"><span class="annottext">FFIType
</span><a href="GHCi.FFI.html#FFIFloat"><span class="hs-identifier hs-var">FFIFloat</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ptr C_ffi_type
</span><a href="GHCi.FFI.html#ffi_type_float"><span class="hs-identifier hs-var">ffi_type_float</span></a></span><span>
</span><span id="line-96"></span><span class="annot"><a href="GHCi.FFI.html#ffiType"><span class="hs-identifier hs-var">ffiType</span></a></span><span> </span><span class="annot"><span class="annottext">FFIType
</span><a href="GHCi.FFI.html#FFIDouble"><span class="hs-identifier hs-var">FFIDouble</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ptr C_ffi_type
</span><a href="GHCi.FFI.html#ffi_type_double"><span class="hs-identifier hs-var">ffi_type_double</span></a></span><span>
</span><span id="line-97"></span><span class="annot"><a href="GHCi.FFI.html#ffiType"><span class="hs-identifier hs-var">ffiType</span></a></span><span> </span><span class="annot"><span class="annottext">FFIType
</span><a href="GHCi.FFI.html#FFISInt8"><span class="hs-identifier hs-var">FFISInt8</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ptr C_ffi_type
</span><a href="GHCi.FFI.html#ffi_type_sint8"><span class="hs-identifier hs-var">ffi_type_sint8</span></a></span><span>
</span><span id="line-98"></span><span class="annot"><a href="GHCi.FFI.html#ffiType"><span class="hs-identifier hs-var">ffiType</span></a></span><span> </span><span class="annot"><span class="annottext">FFIType
</span><a href="GHCi.FFI.html#FFISInt16"><span class="hs-identifier hs-var">FFISInt16</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ptr C_ffi_type
</span><a href="GHCi.FFI.html#ffi_type_sint16"><span class="hs-identifier hs-var">ffi_type_sint16</span></a></span><span>
</span><span id="line-99"></span><span class="annot"><a href="GHCi.FFI.html#ffiType"><span class="hs-identifier hs-var">ffiType</span></a></span><span> </span><span class="annot"><span class="annottext">FFIType
</span><a href="GHCi.FFI.html#FFISInt32"><span class="hs-identifier hs-var">FFISInt32</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ptr C_ffi_type
</span><a href="GHCi.FFI.html#ffi_type_sint32"><span class="hs-identifier hs-var">ffi_type_sint32</span></a></span><span>
</span><span id="line-100"></span><span class="annot"><a href="GHCi.FFI.html#ffiType"><span class="hs-identifier hs-var">ffiType</span></a></span><span> </span><span class="annot"><span class="annottext">FFIType
</span><a href="GHCi.FFI.html#FFISInt64"><span class="hs-identifier hs-var">FFISInt64</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ptr C_ffi_type
</span><a href="GHCi.FFI.html#ffi_type_sint64"><span class="hs-identifier hs-var">ffi_type_sint64</span></a></span><span>
</span><span id="line-101"></span><span class="annot"><a href="GHCi.FFI.html#ffiType"><span class="hs-identifier hs-var">ffiType</span></a></span><span> </span><span class="annot"><span class="annottext">FFIType
</span><a href="GHCi.FFI.html#FFIUInt8"><span class="hs-identifier hs-var">FFIUInt8</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ptr C_ffi_type
</span><a href="GHCi.FFI.html#ffi_type_uint8"><span class="hs-identifier hs-var">ffi_type_uint8</span></a></span><span>
</span><span id="line-102"></span><span class="annot"><a href="GHCi.FFI.html#ffiType"><span class="hs-identifier hs-var">ffiType</span></a></span><span> </span><span class="annot"><span class="annottext">FFIType
</span><a href="GHCi.FFI.html#FFIUInt16"><span class="hs-identifier hs-var">FFIUInt16</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ptr C_ffi_type
</span><a href="GHCi.FFI.html#ffi_type_uint16"><span class="hs-identifier hs-var">ffi_type_uint16</span></a></span><span>
</span><span id="line-103"></span><span class="annot"><a href="GHCi.FFI.html#ffiType"><span class="hs-identifier hs-var">ffiType</span></a></span><span> </span><span class="annot"><span class="annottext">FFIType
</span><a href="GHCi.FFI.html#FFIUInt32"><span class="hs-identifier hs-var">FFIUInt32</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ptr C_ffi_type
</span><a href="GHCi.FFI.html#ffi_type_uint32"><span class="hs-identifier hs-var">ffi_type_uint32</span></a></span><span>
</span><span id="line-104"></span><span class="annot"><a href="GHCi.FFI.html#ffiType"><span class="hs-identifier hs-var">ffiType</span></a></span><span> </span><span class="annot"><span class="annottext">FFIType
</span><a href="GHCi.FFI.html#FFIUInt64"><span class="hs-identifier hs-var">FFIUInt64</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ptr C_ffi_type
</span><a href="GHCi.FFI.html#ffi_type_uint64"><span class="hs-identifier hs-var">ffi_type_uint64</span></a></span><span>
</span><span id="line-105"></span><span>
</span><span id="line-106"></span><span class="hs-keyword">data</span><span> </span><span id="C_ffi_type"><span class="annot"><a href="GHCi.FFI.html#C_ffi_type"><span class="hs-identifier hs-var">C_ffi_type</span></a></span></span><span>
</span><span id="line-107"></span><span class="hs-keyword">data</span><span> </span><span id="C_ffi_cif"><span class="annot"><a href="GHCi.FFI.html#C_ffi_cif"><span class="hs-identifier hs-var">C_ffi_cif</span></a></span></span><span>
</span><span id="line-108"></span><span>
</span><span id="line-109"></span><span class="hs-keyword">type</span><span> </span><span id="C_ffi_status"><span class="annot"><a href="GHCi.FFI.html#C_ffi_status"><span class="hs-identifier hs-var">C_ffi_status</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-identifier hs-type">Word32</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-110"></span><span id="C_ffi_abi"></span><span class="hs-pragma">{-# LINE 110 &quot;libraries\\ghci\\GHCi\\FFI.hsc&quot; #-}</span><span>
</span><span id="line-110"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">C_ffi_abi</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Word32</span><span class="hs-special">)</span><span>
</span><span id="line-111"></span><span class="hs-pragma">{-# LINE 111 &quot;libraries\\ghci\\GHCi\\FFI.hsc&quot; #-}</span><span>
</span><span id="line-111"></span><span>
</span><span id="line-112"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-string">&quot;&amp;ffi_type_void&quot;</span></span><span>   </span><span id="ffi_type_void"><span class="annot"><a href="GHCi.FFI.html#ffi_type_void"><span class="hs-identifier hs-var">ffi_type_void</span></a></span></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_type"><span class="hs-identifier hs-type">C_ffi_type</span></a></span><span>
</span><span id="line-113"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-string">&quot;&amp;ffi_type_uint8&quot;</span></span><span>  </span><span id="ffi_type_uint8"><span class="annot"><a href="GHCi.FFI.html#ffi_type_uint8"><span class="hs-identifier hs-var">ffi_type_uint8</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_type"><span class="hs-identifier hs-type">C_ffi_type</span></a></span><span>
</span><span id="line-114"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-string">&quot;&amp;ffi_type_sint8&quot;</span></span><span>  </span><span id="ffi_type_sint8"><span class="annot"><a href="GHCi.FFI.html#ffi_type_sint8"><span class="hs-identifier hs-var">ffi_type_sint8</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_type"><span class="hs-identifier hs-type">C_ffi_type</span></a></span><span>
</span><span id="line-115"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-string">&quot;&amp;ffi_type_uint16&quot;</span></span><span> </span><span id="ffi_type_uint16"><span class="annot"><a href="GHCi.FFI.html#ffi_type_uint16"><span class="hs-identifier hs-var">ffi_type_uint16</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_type"><span class="hs-identifier hs-type">C_ffi_type</span></a></span><span>
</span><span id="line-116"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-string">&quot;&amp;ffi_type_sint16&quot;</span></span><span> </span><span id="ffi_type_sint16"><span class="annot"><a href="GHCi.FFI.html#ffi_type_sint16"><span class="hs-identifier hs-var">ffi_type_sint16</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_type"><span class="hs-identifier hs-type">C_ffi_type</span></a></span><span>
</span><span id="line-117"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-string">&quot;&amp;ffi_type_uint32&quot;</span></span><span> </span><span id="ffi_type_uint32"><span class="annot"><a href="GHCi.FFI.html#ffi_type_uint32"><span class="hs-identifier hs-var">ffi_type_uint32</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_type"><span class="hs-identifier hs-type">C_ffi_type</span></a></span><span>
</span><span id="line-118"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-string">&quot;&amp;ffi_type_sint32&quot;</span></span><span> </span><span id="ffi_type_sint32"><span class="annot"><a href="GHCi.FFI.html#ffi_type_sint32"><span class="hs-identifier hs-var">ffi_type_sint32</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_type"><span class="hs-identifier hs-type">C_ffi_type</span></a></span><span>
</span><span id="line-119"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-string">&quot;&amp;ffi_type_uint64&quot;</span></span><span> </span><span id="ffi_type_uint64"><span class="annot"><a href="GHCi.FFI.html#ffi_type_uint64"><span class="hs-identifier hs-var">ffi_type_uint64</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_type"><span class="hs-identifier hs-type">C_ffi_type</span></a></span><span>
</span><span id="line-120"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-string">&quot;&amp;ffi_type_sint64&quot;</span></span><span> </span><span id="ffi_type_sint64"><span class="annot"><a href="GHCi.FFI.html#ffi_type_sint64"><span class="hs-identifier hs-var">ffi_type_sint64</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_type"><span class="hs-identifier hs-type">C_ffi_type</span></a></span><span>
</span><span id="line-121"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-string">&quot;&amp;ffi_type_float&quot;</span></span><span>  </span><span id="ffi_type_float"><span class="annot"><a href="GHCi.FFI.html#ffi_type_float"><span class="hs-identifier hs-var">ffi_type_float</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_type"><span class="hs-identifier hs-type">C_ffi_type</span></a></span><span>
</span><span id="line-122"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-string">&quot;&amp;ffi_type_double&quot;</span></span><span> </span><span id="ffi_type_double"><span class="annot"><a href="GHCi.FFI.html#ffi_type_double"><span class="hs-identifier hs-var">ffi_type_double</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_type"><span class="hs-identifier hs-type">C_ffi_type</span></a></span><span>
</span><span id="line-123"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-string">&quot;&amp;ffi_type_pointer&quot;</span></span><span id="ffi_type_pointer"><span class="annot"><a href="GHCi.FFI.html#ffi_type_pointer"><span class="hs-identifier hs-var">ffi_type_pointer</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_type"><span class="hs-identifier hs-type">C_ffi_type</span></a></span><span>
</span><span id="line-124"></span><span>
</span><span id="line-125"></span><span class="annot"><a href="GHCi.FFI.html#fFI_OK"><span class="hs-identifier hs-type">fFI_OK</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.FFI.html#fFI_BAD_ABI"><span class="hs-identifier hs-type">fFI_BAD_ABI</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHCi.FFI.html#fFI_BAD_TYPEDEF"><span class="hs-identifier hs-type">fFI_BAD_TYPEDEF</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_status"><span class="hs-identifier hs-type">C_ffi_status</span></a></span><span>
</span><span id="line-126"></span><span id="fFI_OK"><span class="annot"><span class="annottext">fFI_OK :: C_ffi_abi
</span><a href="GHCi.FFI.html#fFI_OK"><span class="hs-identifier hs-var hs-var">fFI_OK</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">C_ffi_abi
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span>
</span><span id="line-127"></span><span id="fFI_BAD_ABI"><span class="hs-pragma">{-# LINE 127 &quot;libraries\\ghci\\GHCi\\FFI.hsc&quot; #-}</span></span><span>
</span><span id="line-127"></span><span class="hs-identifier">fFI_BAD_ABI</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-number">2</span><span class="hs-special">)</span><span>
</span><span id="line-128"></span><span id="fFI_BAD_TYPEDEF"><span class="hs-pragma">{-# LINE 128 &quot;libraries\\ghci\\GHCi\\FFI.hsc&quot; #-}</span></span><span>
</span><span id="line-128"></span><span class="hs-identifier">fFI_BAD_TYPEDEF</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-number">1</span><span class="hs-special">)</span><span>
</span><span id="line-129"></span><span class="hs-pragma">{-# LINE 129 &quot;libraries\\ghci\\GHCi\\FFI.hsc&quot; #-}</span><span>
</span><span id="line-129"></span><span>
</span><span id="line-130"></span><span class="annot"><a href="GHCi.FFI.html#fFI_DEFAULT_ABI"><span class="hs-identifier hs-type">fFI_DEFAULT_ABI</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_abi"><span class="hs-identifier hs-type">C_ffi_abi</span></a></span><span>
</span><span id="line-131"></span><span id="fFI_DEFAULT_ABI"><span class="annot"><span class="annottext">fFI_DEFAULT_ABI :: C_ffi_abi
</span><a href="GHCi.FFI.html#fFI_DEFAULT_ABI"><span class="hs-identifier hs-var hs-var">fFI_DEFAULT_ABI</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">C_ffi_abi
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span>
</span><span id="line-132"></span><span class="hs-pragma">{-# LINE 132 &quot;libraries\\ghci\\GHCi\\FFI.hsc&quot; #-}</span><span>
</span><span id="line-132"></span><span>
</span><span id="line-133"></span><span class="hs-pragma">{-# LINE 136 &quot;libraries\\ghci\\GHCi\\FFI.hsc&quot; #-}</span><span>
</span><span id="line-136"></span><span>
</span><span id="line-137"></span><span class="hs-comment">-- ffi_status ffi_prep_cif(ffi_cif *cif,</span><span>
</span><span id="line-138"></span><span class="hs-comment">--                         ffi_abi abi,</span><span>
</span><span id="line-139"></span><span class="hs-comment">--                         unsigned int nargs,</span><span>
</span><span id="line-140"></span><span class="hs-comment">--                         ffi_type *rtype,</span><span>
</span><span id="line-141"></span><span class="hs-comment">--                         ffi_type **atypes);</span><span>
</span><span id="line-142"></span><span>
</span><span id="line-143"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-keyword">ccall</span></span><span> </span><span class="annot"><span class="hs-string">&quot;ffi_prep_cif&quot;</span></span><span>
</span><span id="line-144"></span><span>  </span><span id="ffi_prep_cif"><span class="annot"><a href="GHCi.FFI.html#ffi_prep_cif"><span class="hs-identifier hs-var">ffi_prep_cif</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_cif"><span class="hs-identifier hs-type">C_ffi_cif</span></a></span><span>         </span><span class="hs-comment">-- cif</span><span>
</span><span id="line-145"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_abi"><span class="hs-identifier hs-type">C_ffi_abi</span></a></span><span>             </span><span class="hs-comment">-- abi</span><span>
</span><span id="line-146"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Foreign.C.Types.html#CUInt"><span class="hs-identifier hs-type">CUInt</span></a></span><span>                 </span><span class="hs-comment">-- nargs</span><span>
</span><span id="line-147"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_type"><span class="hs-identifier hs-type">C_ffi_type</span></a></span><span>        </span><span class="hs-comment">-- result type</span><span>
</span><span id="line-148"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Ptr.html#Ptr"><span class="hs-identifier hs-type">Ptr</span></a></span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_type"><span class="hs-identifier hs-type">C_ffi_type</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-comment">-- arg types</span><span>
</span><span id="line-149"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="GHCi.FFI.html#C_ffi_status"><span class="hs-identifier hs-type">C_ffi_status</span></a></span><span>
</span><span id="line-150"></span><span>
</span><span id="line-151"></span><span class="hs-comment">-- Currently unused:</span><span>
</span><span id="line-152"></span><span>
</span><span id="line-153"></span><span class="hs-comment">-- void ffi_call(ffi_cif *cif,</span><span>
</span><span id="line-154"></span><span class="hs-comment">--               void (*fn)(),</span><span>
</span><span id="line-155"></span><span class="hs-comment">--               void *rvalue,</span><span>
</span><span id="line-156"></span><span class="hs-comment">--               void **avalue);</span><span>
</span><span id="line-157"></span><span>
</span><span id="line-158"></span><span class="hs-comment">-- foreign import ccall &quot;ffi_call&quot;</span><span>
</span><span id="line-159"></span><span class="hs-comment">--   ffi_call :: Ptr C_ffi_cif             -- cif</span><span>
</span><span id="line-160"></span><span class="hs-comment">--            -&gt; FunPtr (IO ())            -- function to call</span><span>
</span><span id="line-161"></span><span class="hs-comment">--            -&gt; Ptr ()                    -- put result here</span><span>
</span><span id="line-162"></span><span class="hs-comment">--            -&gt; Ptr (Ptr ())              -- arg values</span><span>
</span><span id="line-163"></span><span class="hs-comment">--            -&gt; IO ()</span><span>
</span><span id="line-164"></span></pre></body></html>